#include <stdio.h>
#include <ulib.h>
#include <file.h>
#include <unistd.h>

int
main(void) {
	cprintf("Hello world.\n");
	int* aaa = 0xAFFFFFFF;
	int i, j, k;
//	cprintf("%d\n", *aaa);

	int cpid = fork();
	if (cpid == 0)
	{
		sleep(1200);
		cprintf("hello world !!, I'm the child process\n");

	}
	else
	{
		int fde = open("/how", O_WRONLY | O_CREAT);
		cprintf("File : %d\n", fde);
		sleep(200);
		int kw = checkpoint(0, fde, 3, -1);
		// test file

		if (kw == 0)
		{
			cprintf("hello world !!, I'm the restarted parent %d.\n", i);
			return 0;
		}

		close(fde);
	}

	cprintf("CLose over...\n");

    return 0;
}

